Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][history] refactor history client with redirect wrapper #5762

Closed
wants to merge 1 commit into from

Conversation

shijiesheng
Copy link
Contributor

What changed?

  • moved peerResolver to its own package
  • refactor history client to uniformly use peerResolver's FromRedirectKey method
  • [planned] use codegen to generate redirect wrapper

Why?

simplify history client to make testing easier

How did you test it?

Potential risks

Release notes

Documentation Changes

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

Merging #5762 (76b624f) into master (d1e00cb) will increase coverage by 0.48%.
Report is 4 commits behind head on master.
The diff coverage is 0.00%.

Additional details and impacted files
Files Coverage Δ
common/types/history.go 0.00% <0.00%> (ø)
common/peerresolver/peerResolver.go 48.88% <0.00%> (ø)

... and 13 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1e00cb...76b624f. Read the comment docs.

@@ -950,6 +954,11 @@ func (v *HistoryStartWorkflowExecutionRequest) GetPartitionConfig() (o map[strin
return
}

// ToRedirectKey convert request to redirect key
func (v *HistoryStartWorkflowExecutionRequest) ToRedirectKey() RedirectKey {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test please :)

@@ -100,3 +102,20 @@ func (pr PeerResolver) GetAllPeers() ([]string, error) {
}
return peers, nil
}

// FromRedirectKey resolve the peer from types.RedirectKey by a specific order
func (pr PeerResolver) FromRedirectKey(key types.RedirectKey) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the other PeerResolver.From* functions on can be made private once all usage is refactored. Is that the plan?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's a good suggestion

@@ -22,6 +22,7 @@ package history

import (
"context"
"github.com/uber/cadence/common/peerresolver"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make fmt

if key.HostAddress != "" {
return pr.FromHostAddress(key.HostAddress)
}
return "", fmt.Errorf("RedirectKey is not valid: %v", key)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add unit tests

@@ -100,3 +102,20 @@ func (pr PeerResolver) GetAllPeers() ([]string, error) {
}
return peers, nil
}

// FromRedirectKey resolve the peer from types.RedirectKey by a specific order
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's document the "specific order" so it's more explicit in documentation

@shijiesheng
Copy link
Contributor Author

no other use cases for the wrapper and might just leave it as it is. Also tests are already covering this.

@shijiesheng shijiesheng closed this Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants